-- @owner: wang-tianjing1
-- @date: 2024-08-12
-- @testpoint: timecapsule_创建函数

--step1：创建表               expect：成功
drop table if exists t_timecapsule_test_tmp;
create table t_timecapsule_test_tmp(id int, snaptime timestamptz, snapcsn bigint);

--step2：创建函数     expect：成功
drop function if exists findCsn;
drop function if exists findTime;
CREATE OR REPLACE FUNCTION findCsn(int8)
  RETURNS INTEGER
  LANGUAGE plpgsql
AS
$BODY$
declare
  count integer;
begin
  count = (select snapcsn from t_timecapsule_test_tmp where id =  $1);
  return count;
end;
$BODY$;
/
CREATE OR REPLACE FUNCTION findTime(int8)
  RETURNS timestamptz
  LANGUAGE plpgsql
AS
$BODY$
declare
  count timestamptz;
begin
  count = (select snaptime from t_timecapsule_test_tmp where id =  $1);
  return count;
end;
$BODY$;
/